package llm

import (
	"fmt"

	"techoiceness.com/aiagent/llm-gateway/internal/llm/interfaces"
	"techoiceness.com/aiagent/llm-gateway/internal/llm/providers"
)

type ProviderType string

const (
	ProviderTypeDeepSeek ProviderType = "deepseek"
	ProviderTypeOpenAI   ProviderType = "openai"
)

// 根据提供者类型创建相应的 LLMProvider 实例
func NewLLM(providerType ProviderType, apiURL, apiKey string) (interfaces.LLMProvider, error) {
	if apiURL == "" {
		return nil, fmt.Errorf("apiURL cannot be empty")
	}
	if apiKey == "" {
		return nil, fmt.Errorf("apiKey cannot be empty")
	}

	switch providerType {
	case ProviderTypeDeepSeek:
		return providers.NewDeepSeek(apiURL, apiKey), nil
	case ProviderTypeOpenAI:
		return nil, fmt.Errorf("OpenAI provider is not implemented yet")
	default:
		return nil, fmt.Errorf("unsupported provider type: %s", providerType)
	}
}
